package com.coder.article.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import com.coder.article.pojo.Article;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * 数据访问接口
 * @author Administrator
 *
 */
public interface ArticleDao extends JpaRepository<Article,String>,JpaSpecificationExecutor<Article>{
	//文章审核
    @Modifying  //增删改添加       ?1,表示这个参数位置，即在updateState()中位置
    @Query(value = "UPDATE tb_article SET state = 1 WHERE id = ?",nativeQuery = true)
    public void updateState(String id);

    //文章点赞
    @Modifying  //增删改添加
    @Query(value = "UPDATE tb_article SET thumbup = thumbup+1 WHERE id = ?",nativeQuery = true)
    public void addThumbup(String id);
}
